<template>
	<view class="help-center">
		<!-- <CustomHeader title="常见问题" back-text="返回" @back="goBack" /> -->
		<view class="section">
			<view class="section-title">常见问题</view>
			<view class="question-list">
				<view class="question-item" v-for="(item, index) in questionCategories" :key="index"
					@click="navigateToQuestion(item.id, item.title)">
					<view class="question-header">
						<text class="question-number">{{ index + 1 }}、</text>
						<text class="question-text">{{ item.title }}</text>
					</view>
					<image class="arrow-icon" src="/static/personalCenter/details.png" mode="aspectFill"></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import CustomHeader from '@/components/CustomHeader.vue'
export default {
	components: {
		CustomHeader
	},
	data() {
		return {
			questionCategories: []
		}
	},
	onLoad() {
		this.getQuestionList()
	},
	methods: {
		goBack() {
			uni.navigateBack()
		},
		async getQuestionList() {
			const res = await this.$http.get('/h5/helpCenter/list/0')
			this.questionCategories = res.data.list
		},
		// 导航到具体问题页面
		navigateToQuestion(category, title) {
			uni.navigateTo({
				url: `/pages/personalCenter/helpCenter/questionList?category=${category}&title=${title}`
			})
		}
	}
}
</script>

<style lang="scss" scoped>
.help-center {
	min-height: 100vh;
	background-color: #f5f5f5;
	padding-bottom: 40rpx;
}

.nav-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20rpx 30rpx;
	background-color: #fff;
	border-bottom: 1rpx solid #eee;
}

.back-btn {
	display: flex;
	align-items: center;
}

.back-text {
	color: #ff7937;
	font-size: 28rpx;
}

.title {
	font-size: 36rpx;
	font-weight: bold;
	color: #333;
}

.right-icon image {
	width: 32rpx;
	height: 32rpx;
}

.section {
	margin: 20rpx 26rpx;
	background-color: #fff;
	border-radius: 16rpx;
	padding: 30rpx;
}

.section-title {
	font-size: 32rpx;
	font-weight: bold;
	color: #333;
	margin-bottom: 30rpx;
}

.question-list {
	.question-item {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 30rpx 0;
		border-bottom: 1rpx solid #f0f0f0;

		&:last-child {
			border-bottom: none;
		}
	}

	.question-number {
		font-size: 30rpx;
		color: #333;
		margin-right: 10rpx;
	}


	.question-text {
		font-size: 30rpx;
		color: #333;
	}

	.arrow-icon {
		width: 32rpx;
		height: 32rpx;
	}
}

.footer {
	text-align: center;
	padding: 40rpx 0;

	.copyright {
		font-size: 24rpx;
		color: #999;
	}
}
</style>